8 绘图
QPainter基本绘图
1 | QPainter painter(this);//创建QPainter对象 |
坐标系统和坐标变换
1 | //设计绘制五角星的PainterPath,以便重复使用 |
窗口和视口
视口 不会随着拉动改变大小,坐标原点位于左上角
窗口会随着拉动改变大小,坐标原点位于中心
窗口中的东西要投影到视口才能显示出来
1 | painter.setViewport(rect);//设置Viewport |
Graphics View绘图架构
1 | //要将GraphicView继承才能实现事件重载 |
绘图程序案例
1 | template<class T> void setBrushColor(T *item) |